import * as Icons from '@ant-design/icons-vue'
import { h } from 'vue'


interface Module {
    [p: string]: any
}


function toCameCase(str: string) {
    const st = str.split("-").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join("")
    console.log('转前是%s,转后是%s',str,st)
    return st
}


export default {
    props: {
        icon: String
    },
    setup(props: { icon: string }) {
        const im: Module = Icons;
        const tag = im[toCameCase(props.icon)]
        return () => (tag ? h(tag) : null)
    }

}